<template>
  <!-- 更新领导带班生产记录 -->
  <base-breadcrumb v-loading="loading.GET_DATA">
    <a-card v-if="!isShowPageType && showReplyStatus">
      <a-card :bordered="false" v-if="replyStatus*1 === 0">
        <title-name title="回复" />
        <div class="about-master-container">
          <a-form-model ref="ruleForm" :model="formInfo" :rules="rulesEdit">
            <a-row>
              <a-col span="8">
                <a-form-model-item label="指派" prop="replyUserId">
                  <ASelectOrgPeople
                    style="width: 300px"
                    :disabled="formInfo.pmStatus*1===1"
                    @onSelectChange="getPeople"
                    :selectPeopleName="formInfo.replyUserName"
                    :form="formInfo"
                    :init="false"
                    key-value="projectDeptOrgId"
                    v-model="formInfo.replyUserId"
                  />
                </a-form-model-item>
              </a-col>
              <a-col span="8">
                <a-form-model-item label="完成期限" prop="completeDate">
                  <a-date-picker :disabled="formInfo.pmStatus*1===1" v-model="formInfo.completeDate" value-format="YYYY-MM-DD" type="date" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <template v-if="isProjectManager">
              <a-form-model-item label="项目回复" prop="managerReply">
                <BaseTextarea v-model="formInfo.managerReply" :rows="3" :disabled="isDisabled" :maxLength="500"/>
              </a-form-model-item>
              <a-form-model-item label="照片" prop="replyFileList">
                <upload-list :disabled="isDisabled" :businessCode="'SHE03'" :editModel="1" :uploadArrys.sync="formInfo.replyFileList" uploadType="image" multiple :isMultiple="true"></upload-list>
              </a-form-model-item>
            </template>
          </a-form-model>
        </div>
      </a-card>
      <a-card :bordered="false" v-if="replyStatus*1>2 || projectInfo.acceptanceStatus*1 === 1">
        <title-name title="验收" />
         <div class="about-master-container">
          <a-form-model ref="ruleAccptance" :model="formInfo" :rules="rulesYs">
            <a-row>
              <a-col span="8">
               <a-form-model-item label="是否验收合格" prop="imageProcessTypeId">
                <a-radio-group v-model="formInfo.acceptanceStatus">
                  <a-radio v-for="item in acceptanceStatusList" :key="item.id" :value="item.id">
                    {{ item.name }}
                  </a-radio>
                </a-radio-group>
              </a-form-model-item>
              </a-col>
            </a-row>
            <template v-if="isProjectManager">
              <a-form-model-item :label="formInfo.acceptanceStatus*1===0?'验收情况':'不合格原因'" prop="acceptanceContent">
                <BaseTextarea v-model="formInfo.acceptanceContent" :rows="3" :disabled="isDisabled" :maxLength="500" />
              </a-form-model-item>
              <a-form-model-item label="照片上传" prop="acceptanceFilesList">
                <upload-list :businessCode="'SHE03'" :editModel="1" :uploadArrys.sync="formInfo.acceptanceFilesList" uploadType="image" multiple :isMultiple="true"></upload-list>
              </a-form-model-item>
            </template>
          </a-form-model>
        </div>
      </a-card>
    </a-card>
    <a-card>
      <title-name title="基本信息" />
      <div class="about-master-container">
        <a-form-model>
          <a-row>
            <a-col span="16">
              <a-form-model-item label="所属单位">
                <a-input v-model="formInfo.viewName" disabled />
                <!--<SelectSubCompany v-model="formInfo.branchComId" :disabled="isDisabled" />-->
              </a-form-model-item>
            </a-col>
<!--            <a-col span="8">-->
<!--              <a-form-model-item label="所属项目" prop="projectId">-->
<!--                &lt;!&ndash; <SelectProject-->
<!--                    v-model="formInfo.projectId"-->
<!--                    keyValue="branchComId"-->
<!--                    :form="formInfo"-->
<!--                    :clear-list="true"-->
<!--                    :disabled="isDisabled"-->
<!--                    @change="handleProjectChanged"-->
<!--                    @selectChange="selectChange"-->
<!--                /> &ndash;&gt;-->
<!--                <a-input v-model="projectInfo.projectName" disabled />-->
<!--              </a-form-model-item>-->
<!--            </a-col>-->
            <a-col span="8">
              <a-form-model-item label="项目地址">
                <BaseInput disabled :value="projectInfo.projectAddress" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="项目经理">
                <BaseInput disabled :value="projectInfo.projectManager && projectInfo.projectManager.name" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="联系电话">
                <BaseInput disabled :value="projectInfo.projectManager && projectInfo.projectManager.phone" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="带班领导">
                <BaseInput disabled :value="formInfo.creatorName" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="职务">
                <BaseInput disabled :value="formInfo.postStrs" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="带班时间">
                <BaseInput disabled :value="formInfo.leadDate" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="完成期限" v-if="formInfo.completeDate">
                <BaseInput disabled :value="formInfo.completeDate" />
              </a-form-model-item>
            </a-col>

            <a-col span="16">
              <a-form-model-item label="形象进度" prop="imageProcessTypeId">
                <a-radio-group v-model="formInfo.imageProcessTypeId" disabled>
                  <a-radio v-for="item in processList" :key="item.id" :value="item.id">
                    {{ item.name }}
                  </a-radio>
                </a-radio-group>
              </a-form-model-item>
            </a-col>
            <a-col span="16">
              <a-form-model-item label="风险项目等级" class="fkxmdj">
                <span>{{ formInfo.projectRiskControlLevel }}</span
                ><a style="margin-left: 20px;" @click="riskvisible = true">查看详情</a>
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </div>
      <div class="content">
        <div style="height: 50px; color: black; display: flex; align-items: flex-start">
          <span style="margin-right: 5px">一、二级风险详情: </span>
          <a
            @click="
              visible2 = true
              params = formInfo
            "
            >{{ formInfo.majorRiskNum }}个</a
          >
        </div>
        <div class="item mb10">
          <div class="item-title mb10">
            现场安全生产状况和管理情况：
          </div>
           <span v-for="item in prodManageList" :key="item.id">
              <span v-if="item.id == formInfo.prodManageTypeId">(1){{ item.name }}</span>
            </span>
          <BaseTextarea v-if="formInfo.prodManageTypeNote" v-model="formInfo.prodManageTypeNote" placeholder="无" :rows="3" disabled />
        </div>
        <div class="item mb30">
          <span
            >(2)是否发现本项目存在零容忍安全隐患：<span>{{ formInfo.zeroStatus * 1 === 0 ? '是' : '否' }}</span></span
          >
          <div v-if="(formInfo.zeroStatus && formInfo.zeroStatus * 1 === 0) === 0 ? true : false">
            <p>触犯的零容忍安全隐患:</p>
            <BaseTextarea v-model="zeroCheckName" placeholder="带出" :rows="3" disabled />
          </div>
        </div>
        <div class="item mb30" v-if="(formInfo.zeroStatus && formInfo.zeroStatus * 1 === 0) === 0 ? true : false">
          <span>具体零容忍隐患描述：</span>
          <BaseTextarea v-model="formInfo.zeroContent" placeholder="带出" :rows="3" disabled />
        </div>
        <div class="item mb30">
          <span>(3)其他需整改的隐患：</span>
          <BaseTextarea v-model="formInfo.ontherNeed" placeholder="带出" :rows="3" disabled />
        </div>
        <div class="item mb30" v-if="false">
          <span
            >(2)项目经理/执行经理现场带班安全检查制度落实情况：
            <a @click="visible3 = true">查看</a>
          </span>
          <div class="mb10 mt10">
            <a-radio-group v-model="formInfo.securityCheckSysId" disabled>
              <a-radio :value="item.id" v-for="item in implSituationList" :key="item.id">{{ item.name }}</a-radio>
            </a-radio-group>
          </div>
          <BaseTextarea v-if="formInfo.securityCheckSysNote" v-model="formInfo.securityCheckSysNote" placeholder="无" :rows="3" disabled />

          <!-- <div class="audio" v-if="formInfo.securityCheckSysMp3FileInfo">
            <div class="options" @click="audio3.player.playOrPauseOrResume()">
              <a-icon type="pause-circle" v-if="audio3.isPlay" />
              <a-icon type="play-circle" v-else />
            </div>
            <div class="duration">
              <div class="end">{{ audio3.end }}秒</div>
            </div>
          </div> -->
        </div>
        <div class="item mb30">
          <div class="item-title mb20">下级单位领导带班安全检查制度落实情况</div>
          <span>(1)下级单位领导带班安全检查落实情况：<a @click="visible = true">查看</a></span>
          <!-- <div class="mb10 mt10">
            <a-radio-group v-model="formInfo.securityCheckId" disabled>
              <a-radio :value="item.id" v-for="item in implSituationList" :key="item.id">{{ item.name }}</a-radio>
            </a-radio-group>
          </div> -->
          <BaseTextarea v-if="formInfo.securityCheckNote" v-model="formInfo.securityCheckNote" placeholder="无" :rows="3" disabled />
        </div>
        <div class="item mb30">
          <p>项目经理/执行经理现场带班安全检查制度落实情况：<a @click="visible3 = true">查看</a></p>
          <span>对项目经理零容忍安全隐患追溯：</span>
          <BaseTextarea  v-model="formInfo.projectManaherZeroReview" placeholder="带出" :rows="3" disabled />
        </div>
        <div class="item mb30">
          <span>领导带班问题整改闭合情况：</span>
          <BaseTextarea v-model="formInfo.leadRectification" placeholder="带出" :rows="3" disabled />
        </div>
        <div class="item mb30">
          <div class="mb10">下一步安全生产工作要求：</div>
          <BaseTextarea v-if="formInfo.nextWorkReq" v-model="formInfo.nextWorkReq" placeholder="无" :rows="3" disabled />
          <!--
          <div class="audio" v-if="formInfo.nextWorkReqMp3FileInfo">
            <div class="options" @click="audio4.player.playOrPauseOrResume()">
              <a-icon type="pause-circle" v-if="audio4.isPlay" />
              <a-icon type="play-circle" v-else />
            </div>
            <div class="duration">
              <div class="end">{{ audio4.end }}秒</div>
            </div>
          </div> -->
        </div>
        <div class="item" style="display: flex">
          <span class="mr10">照片：</span>
          <upload-list  :businessCode="'SHE03'" :editModel="0" :uploadArrys.sync="fileNewList"  uploadType="image" multiple :isMultiple="true" />
        </div>
      </div>
    </a-card>
    <a-card v-if="formInfo.replyHistoryDetails && formInfo.replyHistoryDetails.length>0">
      <title-name title="整改落实信息" />
      <a-table :columns="columns" :data-source="formInfo.replyHistoryDetails" bordered :pagination="false" class="zglsxx">
        <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
        <div slot="managerReply" slot-scope="text, record">
          <div v-html="record.managerReply"></div>
        </div>
        <template slot="replyFileList" slot-scope="text, record">
          <UploadList :disabled="true" uploadType="image" multiple :upload-arrys.sync="record.replyFileList" />
        </template>
      </a-table>
    </a-card>
    <a-card v-if="formInfo.acceptanceHistoryDetails && formInfo.acceptanceHistoryDetails.length>0">
      <title-name title="整改验收信息" />
      <a-table :columns="acceptanceColumns" :data-source="formInfo.acceptanceHistoryDetails" bordered :pagination="false" class="zglsxx">
        <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
         <div slot="acceptanceContent" slot-scope="text, record">
           <div v-html="record.acceptanceContent"></div>
        </div>
        <template slot="replyFileList" slot-scope="text, record">
          <UploadList :disabled="true" uploadType="image" multiple :upload-arrys.sync="record.replyFileList" />
        </template>
      </a-table>
    </a-card>
    <!-- v-if="isShowReply" -->
    <a-card v-if="false">
      <title-name title="整改落实情况" />
      <div class="about-master-container">
        <a-form-model ref="form" :model="formInfo" :rules="rules">
          <a-form-model-item label="指派" prop="replyUserId" v-if="isShowReplyUser">
            <ASelectOrgPeople
              style="width: 300px"
              :disabled="isDisabled"
              @onSelectChange="getPeople"
              :selectPeopleName="formInfo.replyUserName"
              :form="formInfo"
              :init="false"
              key-value="projectDeptOrgId"
              v-model="formInfo.replyUserId"
            />
          </a-form-model-item>
          <template>
            <a-form-model-item label="项目回复" prop="managerReply">
              <BaseTextarea v-model="formInfo.managerReply" :rows="3" :disabled="isDisabled" />
            </a-form-model-item>
            <a-form-model-item label="照片" prop="replyFileList">
              <upload-list :disabled="isDisabled" :businessCode="'SHE03'" :editModel="1" :uploadArrys.sync="formInfo.replyFileList" uploadType="image" multiple :isMultiple="true"></upload-list>
            </a-form-model-item>
          </template>
        </a-form-model>
      </div>
    </a-card>
    <div class="tool-btns page-btn-right-top">
      <!--      <BasePrintButton type="primary" :beforePrintFn="print" />-->
      <a-button v-if="pageType === 'edit' && replyStatus*1 === 0" type="primary" :loading="loading.GET_DATA" @click="handleSave()"> 提交 </a-button>
       <a-button v-if="(replyStatus*1>2 || projectInfo.acceptanceStatus*1 === 1) && pageType === 'edit'" type="primary" :loading="loading.GET_DATA" @click="handleAcceptance()"> 提交 </a-button>
      <a-button class="ml20" @click="$close">关闭</a-button>
    </div>
    <sign-modal :type="type" :visible.sync="visible" :initData="initData"></sign-modal>
    <sign-modal2 :visible.sync="visible3" :initData="initData"></sign-modal2>
    <RiskDetail :visible.sync="visible2" :params="params" />
    <RiskControl :visible.sync="riskvisible" :projectRiskControlLevelDetails="formInfo.projectRiskControlLevelDetails"></RiskControl>
  </base-breadcrumb>
</template>

<script>
import { getProjectsDel } from '@/api/project/projects'
import SelectSubCompany from '@/components/Select/SelectSubCompany.vue'
import SelectProject from '@/components/Select/SelectProject.vue'
import UploadList from '@/components/UploadList'
import BasePrintButton from '@/components/BasePrintButton' // 打印按钮
import { getProductionRecordDetail, getProductionRecordDetailPrint, updateProductionRecord, pmReplay, replyUser,stayAcceptance} from '@/api/safetySupervision/safetySystem.js'
import { getSelectListByType } from '@/api/safetySupervision/common.js'
import { getInfoByStaffId } from '@/api/commons'
import signModal from './SignModal'
import signModal2 from './SignModal2'
import RiskControl from './riskControl'
import ASelectOrgPeople from '@/components/Select/ASelectOrgPeople'
import Vue from 'vue'
import RiskDetail from '@/views/safetySupervision/leaderProductionRecord/productionRecordList/RiskDetail' // 版本详情
import SelectPersonByProject from '@/components/Select/SelectPersonByProject'
import { getOrganizeUserListQuick } from '@/api/commons'
import BenzAMRRecorder from 'benz-amr-recorder'
const columns = [
  { title: '序号', dataIndex: 'serial', width: 65, scopedSlots: { customRender: 'serial' } },
  { title: '项目回复', dataIndex: 'managerReply', width: '35%',scopedSlots: { customRender: 'managerReply' } },
  { title: '照片', dataIndex: 'replyFileList', ellipsis: true, width: '40%', scopedSlots: { customRender: 'replyFileList' } },
  { title: '回复人', dataIndex: 'replyUserName', ellipsis: true,align:'center'},
  { title: '回复时间', dataIndex: 'replyDate', ellipsis: true,align:'center'}
]
const acceptanceColumns = [
  { title: '序号', dataIndex: 'serial', width: 65, scopedSlots: { customRender: 'serial' } },
  { title: '是否验收合格', dataIndex: 'acceptanceStatusStr', ellipsis: true,width: 130,align:'center'},
  { title: '验收情况/不合格原因', dataIndex: 'acceptanceContent', width: '30%',scopedSlots: { customRender: 'acceptanceContent' }},
  { title: '验收情况/照片', dataIndex: 'replyFileList', ellipsis: true, width: '35%', scopedSlots: { customRender: 'replyFileList' } },
  { title: '验收人', dataIndex: 'acceptanceUserName', ellipsis: true,align:'center'},
  { title: '验收时间', dataIndex: 'acceptanceDate', ellipsis: true,align:'center'}
]

export default {
  name: 'a' + Date.now(),
  components: {
    UploadList,
    SelectSubCompany,
    SelectProject,
    signModal,
    signModal2,
    BasePrintButton,
    ASelectOrgPeople,
    RiskDetail,
    SelectPersonByProject,
    RiskControl
  },
  data() {
    this.columns = columns
    this.acceptanceColumns = acceptanceColumns
    return {
      implSituationList: [], // 落实情况 type:7
      prodManageList: [], // 现场生产、管理情况 type:5
      processList: [], // 形象进度 type:6
      projectInfo: { projectManager: { posts: [], name: '' }, replyFileList: [], viewName: '' }, // 工程项目相关信息
      editModel: 2, // 操作状态:0 查看;1 编辑;2 新增
      loading: {
        GET_DATA: false,
        DELETE: false,
        DRAFT: false,
        SUBMITTED: false
      },
      type: '1', //1领导带班 2项目经理带班
      visible: false,
      visible3: false,
      visible2: false,
      params: {},
      initData: {},
      formInfo: {
        status: 'DRAFT',
        branchComId: '',
        projectId: '',
        projectDeptOrgId: '',
        fileList: [],
        replyFileList: [],
        imageProcessTypeId: '',
        majorRiskProject: '',
        nextWorkReq: '',
        prodManageTypeId: '',
        securityCheckId: '',
        securityCheckSysId: '',
        replyUserId: undefined,
        approveInfos: [],
        acceptanceList: [],
        viewName: ""
      },
      rules: {
        branchComId: [{ required: true, message: '请选择所属分公司', trigger: 'change' }],
        projectId: [{ required: true, message: '请选择所属项目', trigger: 'change' }],
        imageProcessTypeId: [{ required: true, message: '请选择形象进度', trigger: 'change' }],
        majorRiskProject: [{ required: true, message: '请输入', trigger: 'change' }],
        nextWorkReq: [{ required: true, message: '请输入', trigger: 'change' }],
        prodManageTypeId: [{ required: true, message: '请选择', trigger: 'change' }],
        securityCheckId: [{ required: true, message: '请选择', trigger: 'change' }],
        securityCheckSysId: [{ required: true, message: '请选择', trigger: 'change' }],
        managerReply: [{ required: true, message: '请输入项目回复', trigger: 'change' }],
        replyFileList: [{ required: true, message: '请上传照片', trigger: 'change' }]
      },
      rulesEdit: {
        replyUserId: [{ required: true, message: '请选择', trigger: 'change' }],
        completeDate: [{ required: true, message: '请选择', trigger: 'change' }],
        managerReply: [{ required: true, message: '请输入项目回复', trigger: 'change' }],
      },
      rulesYs:{
           acceptanceContent: [{ required: true, message: '请输入', trigger: 'change' }],
      },
      sss:'1、沧海月明珠有泪 蓝田日暖玉生烟。\n2、此情可待成追忆 只是当时已惘然',
      token: '',
      audio1: {
        isPlay: false,
        player: null,
        start: 0,
        end: 0
      },
      audio2: {
        isPlay: false,
        player: null,
        start: 0,
        end: 0
      },
      audio3: {
        isPlay: false,
        player: null,
        start: 0,
        end: 0
      },
      audio4: {
        isPlay: false,
        player: null,
        start: 0,
        end: 0
      },
      approveInfos: [],
      designatedPersonData: [], //指派人
      riskvisible: false,
      projectRiskControlLevelDetails: [],
      zeroCheckName: null, //触犯的零容忍安全隐患
      capyReplyUserId: null, //默认返回的项目经理id
      replyStatus:-1,
      acceptanceStatus:null,
      acceptanceStatusList:[{name:'是',id:0},{name:'否',id:1}],
      fileNewList:[]
    }
  },
  computed: {
    pageType() {
      return this.$route.query.pageType || 'look'
    },
    isProjectManager() {
      //是否是项目经理
      return this.formInfo.replyUserId === this.capyReplyUserId
    },
    isShowPageType() {
      let pageType = this.pageType === 'look' ? true : false
      return pageType
    },
    isDisabled() {
      return this.pageType === 'look'
    },
    isShowReply() {
      if (this.isDisabled) {
        return this.formInfo.replyStatus === 2
      }
      return true
    },
    isShowReplyUser() {
      if (this.isDisabled) {
        return false
      }
      return this.formInfo.pmStatus === 0
      // if (this.formInfo.replyUserId) {
      //   return true
      // } else {
      //   if (this.isDisabled) {
      //     return false
      //   }
      //   return this.formInfo.pmStatus === 0
      // }
    },
    getPost() {
      return this.projectInfo?.projectManager?.posts?.map((v) => v.name).join('、')
    },
    showReplyStatus(){
      let flag =  (this.replyStatus*1 === 0 || this.replyStatus*1 >2) && this.replyStatus*1!=10;
      return flag;
    }
  },
  async created() {
    this.token = Vue.getAcloudProvider().getAccessToken()

    if (this.$route.query.id) {
      this.formInfo.id = this.$route.query.id
      await this.getDetail()
      await this.getOrganizeUserListData()
    }
    this.getAllSelectList()
  },
  methods: {
    //获取指派人数据
    getOrganizeUserListData() {
      getOrganizeUserListQuick({ projectId: this.formInfo.projectId }).then((res) => {
        let data = res.data
        if (data.length > 0) {
          data.map((item) => {
            item.value = item.userId
            item.label = item.name
          })
        }
        this.designatedPersonData = res.data
      })
    },
    getMp3(file) {
      // return 'http://localhost:8000/api/ycloud-file-center/oper/download?access_token=7365a71b2518fa6f0f7dc07e1abea4d5&fileId=16388959018E9F300CBFE303172B9C01&fullfilename=16388959018E9F300CBFE303172B9C01.mp3'
      if (!file) return
      return window.location.origin + '/api/ycloud-file-center/oper/download?access_token=' + this.token + '&fileId=' + file.fileId + '&fullfilename=' + file.alias
    },
    async getPeople(e) {
      this.formInfo.replyUserName = e.name
    },
    print() {
      return getProductionRecordDetailPrint({ id: this.formInfo.id }).then((res) => {
        return res[1].data.content
      })
    },
    handerPage() {
      this.$router.push({
        name: 'UpdateProjectControl',
        query: {
          pageType: 'look',
          id: this.formInfo.criticalProjectId || ''
        }
      })
    },
    // 获取下拉列表数据
    getAllSelectList() {
      const loopList = [
        { name: 'processList', type: 6 },
        { name: 'prodManageList', type: 5 },
        { name: 'implSituationList', type: 7 }
      ]
      loopList.forEach((item) => {
        this.getSelectList(item.type, item.name)
      })
    },
    async getSelectList(type, name) {
      const [err, res] = await getSelectListByType({ type })
      if (!err) {
        this[name] = res.data || []
      }
    },
    filterEditModel(type) {
      let flag = ''
      switch (type) {
        case 'add':
          flag = 2
          break
        case 'edit':
          flag = 1
          break
        case 'look':
          flag = 0
          break
        default:
          flag = 0
          break
      }
      return flag
    },
    async getDetail() {
      this.loading.GET_DATA = true
      const [err, res] = await getProductionRecordDetail({ id: this.formInfo.id })
      if (!err) {
        // if (res.data.pmStatus === 0) {
        //   if (res.data.replyUserId === this.$userInfo().id) {
        //     res.data.replyUserId = ''
        //     res.data.replyUserName = ''
        //   }
        // }
        this.formInfo = { ...this.formInfo, ...res.data }
        console.log( this.formInfo, ' this.formInfo')
        this.formInfo.viewName = this.formInfo.branchComName + '/' + this.formInfo.projectName
        await this.handleProjectChanged(this.formInfo.projectId)

        let zeroCheckTypes = this.formInfo.zeroCheckTypes || []
        if (zeroCheckTypes.length) {
          let names = zeroCheckTypes.map((e) => e.name)
          this.zeroCheckName = names.join(',')
        }
        this.capyReplyUserId = this.formInfo.replyUserId ? JSON.parse(JSON.stringify(this.formInfo.replyUserId)) : null;
        if(this.formInfo.replyStatus==null){
          this.replyStatus = 10
        }else{
          this.replyStatus = this.formInfo.replyStatus;
        }

        this.acceptanceStatus = this.formInfo.acceptanceStatus;
        this.formInfo.acceptanceStatus = this.formInfo.acceptanceStatus?? 0;
        if( this.formInfo.replyHistoryDetails?.length>0){
           this.formInfo.replyHistoryDetails.map((item)=>item.managerReply=item.managerReply.replace(/\n/g, '<br/>'))
        }
        if( this.formInfo.acceptanceHistoryDetails?.length>0){
           this.formInfo.acceptanceHistoryDetails.map((item)=>item.acceptanceContent=item.acceptanceContent.replace(/\n/g, '<br/>'))
        }
        this.fileNewList = [];
        if(this.formInfo.fileNewList && this.formInfo.fileNewList.length>0){
             this.formInfo.fileNewList.map((item)=>{{
                  if(item.fileInfoVOS && item.fileInfoVOS.length>0){
                    item.fileInfoVOS.map((childItem)=>{
                       childItem && this.fileNewList.push(childItem)
                    })
                  }
             }})
        }

      }
      this.loading.GET_DATA = false
    },
    async initAudio(audio, file) {
      let src = this.getMp3(file)
      audio.player = new BenzAMRRecorder()
      await audio.player.initWithUrl(src)
      audio.end = audio.player.getDuration()
      audio.player.onEnded(() => {
        audio.isPlay = false
      })
      audio.player.onPause(() => {
        audio.isPlay = false
      })
      audio.player.onPlay(() => {
        audio.isPlay = true
      })
      audio.player.onResume(() => {
        audio.isPlay = true
      })
    },
    async handleProjectChanged(id) {
      if (!id) return (this.projectInfo = {})
      const res = await getProjectsDel({ projectId: id }) // 获取项目详情信息
      this.initData = this.projectInfo = res.data || {}
      this.formInfo.projectDeptOrgId = res.data.projectDeptOrgId
      if (res.data.realityPmId) {
        const employee = await getInfoByStaffId(res.data.realityPmId)
        if (employee.data) {
          this.projectInfo.projectManager = employee.data
        }
      }
    },
    async handleSave() {
      this.$refs.ruleForm.validate(async (valid) => {
        let replyFileList = this.formInfo.replyFileList,
        flag = replyFileList && replyFileList.length>0?true:false;
        if (valid) {
          if(this.isProjectManager && !flag){
              this.$noticeWarning('请上传照片')
              return false;
          }
          let param = {
            id:this.formInfo.id,
            completeDate:this.formInfo.completeDate,
            managerReply:this.formInfo.managerReply,
            replyFileList:this.formInfo.replyFileList,
          }
          let paramTwo = {
            id:this.formInfo.id,
            completeDate:this.formInfo.completeDate,
            replyUserId: this.formInfo.replyUserId,
            replyUserName: this.formInfo.replyUserName,
            replyEmpId:this.formInfo.replyEmpId
          }
          this.loading.GET_DATA = true
          // replyUser 指派给其他人，isProjectManager 是项目经理
          const params = this.isProjectManager? param:paramTwo;
          const fn = this.isProjectManager? pmReplay: replyUser
          const [err, res] = await fn(params)
          this.loading.GET_DATA = false
          if (!err) {
            this.$message.success('成功')
            this.$close()
          }
        } else {
          this.$noticeWarning('请填写完整')
        }
      })
    },
    async handleAcceptance(){
        this.$refs.ruleAccptance.validate(async (valid) => {
        if (valid) {
            let params = {
                acceptanceStatus: this.formInfo.acceptanceStatus,
                acceptanceContent: this.formInfo.acceptanceContent,
                acceptanceUserId:JSON.parse(sessionStorage.getItem('ycloud-user_info')).id,  //当前登录人的id
                acceptanceUserName:JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,  //当前登录人的名字
                acceptanceFilesList: this.formInfo.acceptanceFilesList,
                id: this.formInfo.id,
            }
          this.loading.GET_DATA = true
          const fn = stayAcceptance;
          const [err, res] = await fn(params)
          this.loading.GET_DATA = false
          if (!err) {
            this.$message.success('成功')
            this.$close()
          }
        } else {
          this.$noticeWarning('请填写完整')
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
@deep: ~'>>>';
.content {
  padding-left: 50px;

  .item {
    .item-title {
      font-size: 16px;
      font-weight: bold;
      margin-top: 10px;
    }

    .audio {
      margin-top: 15px;
      margin-bottom: 15px;
      width: 200px;
      display: flex;
      padding: 0 30px;
      border-radius: 30px;
      border: 1px solid #d9d9d9;
      background: #f5f5f5;

      .options {
        font-size: 22px;
      }

      .duration {
        margin-left: 20px;
        display: flex;
        align-items: center;
        flex: 1;
      }

      .progress {
        margin: 0 0.6rem;
        flex: 1;
        position: relative;
        display: flex;
        align-items: center;

        //.slide-bar {
        //  position: absolute;
        //  height: 2rem;
        //  width: 100%;
        //  top: -1rem;
        //  z-index: 9;
        //}

        &:before {
          z-index: 8;
          content: ' ';
          height: 3px;
          width: 100%;
          background: white;
          position: absolute;
        }

        .line {
          z-index: 9;
          content: '';
          position: absolute;
          height: 3px;
          width: 100%;
          background: rgb(2, 167, 240);
        }

        .point {
          z-index: 9;
          position: absolute;
          left: 0;
          //top: -3px;
          height: 8px;
          width: 8px;
          border-radius: 50%;
          background: rgb(2, 167, 240);
        }
      }
    }
  }
}
.about-master-container{
   .fkxmdj{
    @{deep} .ant-form-item-label{
   padding: 10px 4px 0 0;
 }
 }
}

.mb30 {
  margin-bottom: 30px;
}
.zglsxx{
  @{deep} textarea{
    background: transparent;
    border:none;
    resize: none!important;
  }
}
</style>
